package jdkDemo;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

public class Test4 {
	public static void main(String[] args) throws ParseException {
		Date date = new Date();
		Date date2 = new Date();
		System.out.println(date.getTime() == date2.getTime());
		
		
		Calendar calendar = Calendar.getInstance();
		calendar.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo"));
		calendar.set(1999,10,1,12,23);
		Date d =calendar.getTime();
		System.out.println(d);
		
		DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh-mm-ss");
		String format = dateFormat.format(d);
		System.out.println(format);
		
		String ds = "1999-11-01 12-23-43";
		Date dd = dateFormat.parse(ds);
		System.out.println(dd);
		
		java.sql.Date dd1 = new java.sql.Date(1999, 2, 3);
		Date dd2 = new Date(dd1.getTime());
		System.out.println(dd2);
		
	}

}
